package com.hd.appcommon.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hd.appcommon.entity.Dept;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author administrator
 * @since 2020-11-24
 */
@Repository
@Mapper
public interface DeptMapper extends BaseMapper<Dept> {

    @Select("select leaderids from  dept " +
            " where leaderids is not null " +
            "and leaderids <>'' GROUP BY leaderids ")
    List<String> getHasAdminLeaderids();

    List<Dept> getDeptAndFatherDept(@Param("deptIds") String[] deptIds);

    @Select("SELECT id from dept ${ew.customSqlSegment}")
    List<String> getIds(@Param("ew") QueryWrapper<Dept> queryWrapper);

    @Select("SELECT name from dept ${ew.customSqlSegment}")
    List<String> getNameStrings(@Param("ew")QueryWrapper<Dept>queryWrapper);
}
